<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="/WEB-INF/c.tld" %>
<%@ taglib prefix="fmt" uri="/WEB-INF/fmt.tld" %>
	<form action="${contextPath }/admin/user/update.do" method="post">
<table width="100%">
	<c:if test="${obj.user != null}">
	<tbody>
		<tr>
			<td>编号</td>
			<td>${obj.user.id }<input name="user.id" type="hidden" value="${obj.user.id}"/></td>
		</tr>
		<tr>
			<td>用户名</td>
			<td>${obj.user.username }</td>
		</tr>
		<tr>
			<td>昵称</td>
			<td><input name="user.nickName" value="${obj.user.nickName }"/></td>
		</tr>
		<tr>
			<td>email</td>
			<td>${obj.user.email }</td>
		</tr>
		<tr>
			<td>密码</td>
			<td><input name="user.password" type="password" value=""/></td>
		</tr>
		<tr>
			<td>地址</td>
			<td><input name="user.address" value="${obj.user.address }"/></td>
		</tr>
		<tr>
			<td>手机</td>
			<td><input name="user.phone" value="${obj.user.phone }"/></td>
		</tr>
		<tr>
			<td>电话</td>
			<td><input name="user.telephone" value="${obj.user.telephone }"/></td>
		</tr>
		<tr>
			<td>注册ip</td>
			<td>${obj.user.lastLoginIp }</td>
		</tr>
		<tr>
			<td>注册时间</td>
			<td><fmt:formatDate pattern="yyyy-MM-dd hh:mm:ss" value="${obj.user.lastLoginTime }"/></td>
		</tr>
		<tr>
			<td>状态</td>
			<td><select name="user.state">
					<c:if test="${obj.user.state==0}">
						<option selected="selected" value="0">禁用</option>
					</c:if>
					<c:if test="${obj.user.state!=0}">
						<option value="0">禁用</option>
					</c:if>
					<c:if test="${obj.user.state==1}">
						<option selected="selected" value="1">验证</option>
					</c:if>
					<c:if test="${obj.user.state!=1}">
						<option value="1">验证</option>
					</c:if>
					<c:if test="${obj.user.state==2}">
						<option selected="selected" value="2">成功</option>
					</c:if>
					<c:if test="${obj.user.state!=2}">
						<option value="2">成功</option>
					</c:if>
			    </select>
		</tr>
		<tr>
			<td>用户类型</td>
			<td>
				<c:if test="${obj.user.type==0}">
					普通会员
				</c:if>
				<c:if test="${obj.user.type==1}">
					供应商
				</c:if>
		</tr>
		<tr>
			<td>角色</td>
			<td>
			<c:forEach items="${obj.roles}" var="role">
				<c:set var="result" value="false"/>
				<c:forEach items="${obj.user.roles}" var="ur">
					<c:if test="${role.id==ur.id}">
						<c:set var="result" value="true"/>
					</c:if>
				</c:forEach>
				<c:if test="${result}">
					<input name="ids" checked="checked" type="checkbox" value="${role.id }"/>${role.name }
				</c:if>
				<c:if test="${!result}">
					<input name="ids" type="checkbox" value="${role.id }"/>${role.name}
				</c:if>
			</c:forEach>
			</td>
		</tr>
		<tr>
			<td><input type="submit" value="保存"/></td><td></td>
		</tr>
	</tbody>
	</c:if>
</table>
	</form>